<template>
    <div class="reportFormPage" v-if="show">
        <div id="domid" class="report-dom">
            <!-- 头部标题区 -->
            <el-row>
                <el-col :span="5" :offset="19">
                    <div class="pageNumBox">
                        <span>第</span>
                        <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
                        <span>页，共</span>
                        <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
                        <span>页</span>
                    </div>
                </el-col>
            </el-row>
            <div class="topTwoBox">
                <div class="centerName">{{ form.baobmc }}</div>
                <div class="codeText">{{ form.baobbh }}</div>
            </div>
            <div class="threeTopBox">
                <div class="left-border">
                    <div class="box-title">检测单位名称：</div>
                    <div class>
                        {{
                        form.jiancdwmc
                        }}
                    </div>
                </div>
                <div class="right-border">
                    <span>记录编号：</span>
                    <span class="placeholder">{{ form.jilbh }}</span>
                </div>
            </div>
            <!-- 表格主要内容区 -->
            <div class="table-border">
                <!-- 主要内容表格 -->
                <table height="220px" class="top-table">
                    <tbody>
                    <tr>
                        <td height="30" align="center" width="15%">
                            <span style="width: 90px; display: inline-block">工程名称</span>
                        </td>
                        <td width="35%" class="text-center">
                            <span>{{ form.gongcmc }}</span>
                        </td>
                        <td align="center" width="15%">
                            <span style="width: 90px; display: inline-block">工程部位/用途</span>
                        </td>
                        <td width="35%" class="text-center">
                            <span>{{ form.gongcbwyt }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="50" align="center">样品信息</td>
                        <td class="specimen-border" colspan="3">
                            <span>样品名称：</span>
                            <span :class="{ placeholder: !form.yangpmc }">{{ form.yangpmc }}</span>
                            <span>；样品编号：</span>
                            <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>
                            <span>；样品数量：</span>
                            <span :class="{ placeholder: !form.yangpsl }">{{ form.yangpsl }}</span>
                            <span>；样品状态：</span>
                            <span :class="{ placeholder: !form.yangpzt }">{{ form.yangpzt }}</span>
                            <span>；来样时间：</span>
                            <span :class="{ placeholder: !form.yangpsj }">{{ form.yangpsj }}</span>
                        </td>
                    </tr>

                    <tr>
                        <td height="25" align="center" width="15%">
                            <span style="width: 90px; display: inline-block">试验检测日期</span>
                        </td>
                         <!-- <td width="35%" class="text-center">{{ form.shiyjcrq }}</td> -->                                            
 <td width="35%" class="text-center">
      <el-input v-model="form.shiyjcrq" />
</td>
                        <td align="center" width="15%">
                            <span style="width: 90px; display: inline-block">试验条件</span>
                        </td>
                        <td v-if="isPdf" width="35%">
                            温度：
                            <span style="display: inline-block; width: 10%">{{ form.shiytjwd }}</span>
                            ℃；湿度：
                            <span style="display: inline-block; width: 10%">{{ form.shiytjsd }}</span
                            >%RH
                        </td>
                        <td v-else width="35%">
                            温度：
                            <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjwd" style="width: 15%"/>
                            ℃；湿度：
                            <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjsd" style="width: 15%"/>
                            %RH
                        </td>
                    </tr>

                    <tr>
                        <td height="50" align="center" width="15%">
                            <span style="width: 90px; display: inline-block">检测依据</span>
                        </td>
                        <td width="35%">
                            <span v-if="isPdf">{{ form.jiancyj }}</span>
                            <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark"
                                      @dblclick.native="showBsJiancyjView" readonly/>
                        </td>
                        <td align="center" width="15%">
                            <span style="width: 90px; display: inline-block">判定依据</span>
                        </td>
                        <td width="35%">
                            <span v-if="isPdf">{{ form.pandyj }}</span>
                            <el-input v-else type="textarea" v-model="form.pandyj" :rows="2"
                                      @dblclick.native="showBsJudgeBaseView" @focus="handleFocus('pandyj')"
                                      class="mark"/>
                        </td>
                    </tr>
                    <tr class="bottom-border">
                        <td height="50" align="center">
                            <div>主要仪器设备</div>
                            <div>名称及编号</div>
                        </td>
                        <td colspan="3">
                            <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                            <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh"
                                      class="height100 width100 mark" @dblclick.native="showBsInstrumentView"
                                      readonly></el-input>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- 表1-质量损失-->
                <table class="middle-table" style="height: 90px;">
                    <tbody>
                    <tr>
                        <td class="text-center" style="width: 8%;" height="90" rowspan="3">
                            <span style="width:25px;display:inline-block">质量损失(%)</span>
                        </td>
                        <td class="text-center" style="width: 7%;">
                            <span style="width:25px;display:inline-block">试验次数</span>
                        </td>
                        <td class="text-center" style="width: 10%;">
                            <span style="width:60px;display:inline-block">盛样皿质量(g)</span>
                        </td>
                        <td class="text-center" style="width: 25%;">
                            <span style="width:150px;display:inline-block">加热前盛样皿与试样质量(g)</span>
                        </td>
                        <td class="text-center" style="width: 21%;">
                            <span style="width:120px;display:inline-block">加热后盛样皿与试样质量(g)</span>
                        </td>
                        <td class="text-center" style="width: 11%;">
                            <span style="display:inline-block">质量变化(%)</span>
                        </td>
                        <td class="text-center" style="width: 18%;">
                            <span style="display:inline-block">平均值(%)</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="30">1</td>
                        <td>
                            <el-input type="number"
                                      v-model="form.a1"
                                      @change="computeZlbh(1)"
                                      @keydown.native="handleKeyDown($event, 0, 0)"
                                      @paste.native="handlePaste($event,  0, 0)"
                                      :ref="`0_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.b1"
                                      @change="computeZlbh(1)"
                                      @keydown.native="handleKeyDown($event, 0, 1)"
                                      @paste.native="handlePaste($event,  0, 1)"
                                      :ref="`0_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.c1"
                                      @change="computeZlbh(1)"
                                      @keydown.native="handleKeyDown($event, 0, 2)"
                                      @paste.native="handlePaste($event,  1, 2)"
                                      :ref="`0_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block;">{{ form.d1 }}</span>
                        </td>
                        <td class="text-center" rowspan="2">
                            <span style="display:inline-block;">{{ form.e1 }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="30">2</td>
                        <td>
                            <el-input type="number"
                                      v-model="form.a2"
                                      @change="computeZlbh(2)"
                                      @keydown.native="handleKeyDown($event, 1, 0)"
                                      @paste.native="handlePaste($event,  1, 0)"
                                      :ref="`1_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.b2"
                                      @change="computeZlbh(2)"
                                      @keydown.native="handleKeyDown($event, 1, 1)"
                                      @paste.native="handlePaste($event,  1, 1)"
                                      :ref="`1_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.c2"
                                      @change="computeZlbh(2)"
                                      @keydown.native="handleKeyDown($event, 1, 2)"
                                      @paste.native="handlePaste($event,  1, 2)"
                                      :ref="`1_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block;">{{ form.d2 }}</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- 表2-残留针入度比-->
                <table class="middle-table" style="height: 120px;">
                    <tbody>
                    <tr>
                        <td class="text-center" style="width: 8%;" height="90" rowspan="4">
                            <span style="width:25px;display:inline-block">残留针入度比(%)</span>
                        </td>
                        <td class="text-center" style="width: 7%;" rowspan="2">
                            <span style="width:25px;display:inline-block">试样</span>
                        </td>
                        <td class="text-center" style="width: 7%;" rowspan="2">
                            <span style="width:30px;display:inline-block">试验温度(℃)</span>
                        </td>
                        <td class="text-center" style="width: 13%;" rowspan="2">
                            <span style="width:55px;display:inline-block">荷重(g)</span>
                        </td>
                        <td class="text-center" style="width: 15%;" rowspan="2">
                            <span style="width:70px;display:inline-block">贯入时间(s)</span>
                        </td>

                        <td class="text-center" style="width: 32%;" colspan="4">
                            <span style="display:inline-block">针入度(0.1mm)</span>
                        </td>
                        <td class="text-center" style="width: 18%;" rowspan="2">
                            <span style="display:inline-block">残留针入度比(%)</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-center" style="width: 7%;">
                            <span style="display:inline-block">1</span>
                        </td>
                        <td class="text-center" style="width: 7%;">
                            <span style="display:inline-block">2</span>
                        </td>
                        <td class="text-center" style="width: 7%;">
                            <span style="display:inline-block">3</span>
                        </td>
                        <td class="text-center" style="width: 11%;">
                            <span style="display:inline-block">平均值</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="30">原样</td>
                        <td rowspan="2">
                            <el-input type="number"
                                      v-model="form.a3"
                                      @change="backBgClzrdb"
                                      @keydown.native="handleKeyDown($event, 2, 0)"
                                      :ref="`2_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td rowspan="2">
                            <el-input type="number"
                                      v-model="form.b3"
                                      @keydown.native="handleKeyDown($event, 2, 1)"
                                      :ref="`2_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td rowspan="2">
                            <el-input type="number"
                                      v-model="form.c3"
                                      @keydown.native="handleKeyDown($event, 2, 2)"
                                      :ref="`2_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.d3"
                                      @change="computeZrdPjz(3)"
                                      @keydown.native="handleKeyDown($event, 2, 3)"
                                      @paste.native="handlePasteTwo($event,  0, 0)"
                                      :ref="`2_3`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.e3"
                                      @change="computeZrdPjz(3)"
                                      @keydown.native="handleKeyDown($event, 2, 4)"
                                      @paste.native="handlePasteTwo($event,  0, 1)"
                                      :ref="`2_4`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.f3"
                                      @change="computeZrdPjz(3)"
                                      @keydown.native="handleKeyDown($event, 2, 5)"
                                      @paste.native="handlePasteTwo($event,  0, 2)"
                                      :ref="`2_5`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block">{{ form.g3 }}</span>
                        </td>
                        <td class="text-center" rowspan="2">
                            <span style="display:inline-block">{{ form.h3 }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td style="width:25px" height="30">残留样</td>
                        <td>
                            <el-input type="number"
                                      v-model="form.d4"
                                      @change="computeZrdPjz(4)"
                                      @keydown.native="handleKeyDown($event, 3, 0)"
                                      @paste.native="handlePasteTwo($event,  1, 0)"
                                      :ref="`3_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.e4"
                                      @change="computeZrdPjz(4)"
                                      @keydown.native="handleKeyDown($event, 3, 1)"
                                      @paste.native="handlePasteTwo($event,  1, 1)"
                                      :ref="`3_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.f4"
                                      @change="computeZrdPjz(4)"
                                      @keydown.native="handleKeyDown($event, 3, 2)"
                                      @paste.native="handlePasteTwo($event,  1, 2)"
                                      :ref="`3_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block">{{ form.g4 }}</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- 表3-残留延度-->
                <table class="middle-table" style="height: 120px;">
                    <tbody>
                    <tr>
                        <td class="text-center" style="width: 8%;" height="90" rowspan="4">
                            <span style="width:25px;display:inline-block">残留延度(cm)</span>
                        </td>
                        <td class="text-center" style="width: 7%;" rowspan="2">
                            <span style="width:25px;display:inline-block">试验温度(℃)</span>
                        </td>
                        <td class="text-center" style="width: 10%;" rowspan="2">
                            <span style="width:60px;display:inline-block">保温时间(min)</span>
                        </td>
                        <td class="text-center" style="width: 18%;" rowspan="2">
                            <span style="width:100px;display:inline-block">拉伸速度(cm/min)</span>
                        </td>

                        <td class="text-center" style="width: 57%;" colspan="4">
                            <span style="display:inline-block">延度(cm)</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-center" style="width: 14%;">
                            <span style="display:inline-block">1</span>
                        </td>
                        <td class="text-center" style="width: 14%;">
                            <span style="display:inline-block">2</span>
                        </td>
                        <td class="text-center" style="width: 11%;">
                            <span style="display:inline-block">3</span>
                        </td>
                        <td class="text-center" style="width: 18%;">
                            <span style="display:inline-block">平均值(cm)</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="30">
                            <el-input type="number"
                                      v-model="form.a5"
                                      @change="backBgClyd"
                                      @keydown.native="handleKeyDown($event, 4, 0)"
                                      @paste.native="handlePasteThree($event,  0, 0)"
                                      :ref="`4_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.b5"
                                      @keydown.native="handleKeyDown($event, 4, 1)"
                                      @paste.native="handlePasteThree($event,  0, 1)"
                                      :ref="`4_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.c5"
                                      @keydown.native="handleKeyDown($event, 4, 2)"
                                      @paste.native="handlePasteThree($event,  0, 2)"
                                      :ref="`4_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.d5"
                                      @change="computeYd(5)"
                                      @keydown.native="handleKeyDown($event, 4, 3)"
                                      @paste.native="handlePasteThree($event,  0, 3)"
                                      :ref="`4_3`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.e5"
                                      @change="computeYd(5)"
                                      @keydown.native="handleKeyDown($event, 4, 4)"
                                      @paste.native="handlePasteThree($event,  0, 4)"
                                      :ref="`4_4`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.f5"
                                      @change="computeYd(5)"
                                      @keydown.native="handleKeyDown($event, 4, 5)"
                                      @paste.native="handlePasteThree($event,  0, 5)"
                                      :ref="`4_5`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center">
                            <span>{{ form.g5 }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="30">
                            <el-input type="number"
                                      v-model="form.a6"
                                      @change="backBgClyd"
                                      @keydown.native="handleKeyDown($event, 5, 0)"
                                      @paste.native="handlePasteThree($event,  1, 0)"
                                      :ref="`5_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.b6"
                                      @keydown.native="handleKeyDown($event, 5, 1)"
                                      @paste.native="handlePasteThree($event,  1, 1)"
                                      :ref="`5_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.c6"
                                      @keydown.native="handleKeyDown($event, 5, 2)"
                                      @paste.native="handlePasteThree($event,  1, 2)"
                                      :ref="`5_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.d6"
                                      @change="computeYd(6)"
                                      @keydown.native="handleKeyDown($event, 5, 3)"
                                      @paste.native="handlePasteThree($event,  1, 3)"
                                      :ref="`5_3`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.e6"
                                      @change="computeYd(6)"
                                      @keydown.native="handleKeyDown($event, 5, 4)"
                                      @paste.native="handlePasteThree($event,  1, 4)"
                                      :ref="`5_4`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.f6"
                                      @change="computeYd(6)"
                                      @keydown.native="handleKeyDown($event, 5, 5)"
                                      @paste.native="handlePasteThree($event,  1, 5)"
                                      :ref="`5_5`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block">{{ form.g6 }}</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- 表4-残留软化点增值-->
                <table class="middle-table" style="height: 120px;">
                    <tbody>
                    <tr>
                        <td class="text-center" style="width: 8%;" height="90" rowspan="4">
                            <span style="width:25px;display:inline-block">残留软化点增值(℃)</span>
                        </td>
                        <td class="text-center" style="width: 7%;" rowspan="2">
                            <span style="width:25px;display:inline-block">试样</span>
                        </td>
                        <td class="text-center" style="width: 7%;" rowspan="2">
                            <span style="width:35px;display:inline-block">起始温度(℃)</span>
                        </td>
                        <td class="text-center" style="width: 13%;" rowspan="2">
                            <span style="width:60px;display:inline-block">加热介质</span>
                        </td>
                        <td class="text-center" style="width: 8%;" rowspan="2">
                            <span style="width:50px;display:inline-block">升温速度(℃/min)</span>
                        </td>

                        <td class="text-center" style="width: 39%;" colspan="2">
                            <span style="display:inline-block">软化点(℃)</span>
                        </td>
                        <td class="text-center" style="width: 18%;" rowspan="2">
                            <span style="width:75px;display:inline-block">残留软化点增值(℃)</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-center">
                            <span style="display:inline-block">1</span>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block">2</span>
                        </td>
                    </tr>

                    <tr>
                        <td height="30">
                            <span style="display:inline-block">原样</span>
                        </td>
                        <td rowspan="2">
                            <el-input type="number"
                                      v-model="form.a7"
                                      @keydown.native="handleKeyDown($event, 6, 0)"
                                      :ref="`6_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td rowspan="2">
                            <el-input type="number"
                                      v-model="form.b7"
                                      @keydown.native="handleKeyDown($event, 6, 1)"
                                      :ref="`6_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td rowspan="2">
                            <el-input type="number"
                                      v-model="form.c7"
                                      @keydown.native="handleKeyDown($event, 6, 2)"
                                      :ref="`6_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>

                        <td>
                            <el-input type="number"
                                      v-model="form.d7"
                                      @keydown.native="handleKeyDown($event, 6, 3)"
                                      @paste.native="handlePasteFour($event,  0, 0)"
                                      :ref="`6_3`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.e7"
                                      @keydown.native="handleKeyDown($event, 6, 4)"
                                      @paste.native="handlePasteFour($event,  0, 1)"
                                      :ref="`6_4`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center" rowspan="2">
                            <span style="display:inline-block">{{ form.f7 }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="30">
                            <span style="display:inline-block">残留样</span>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.d8"
                                      @change="computeClrhdzz"
                                      @keydown.native="handleKeyDown($event, 7, 0)"
                                      @paste.native="handlePasteFour($event,  1, 0)"
                                      :ref="`7_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.e8"
                                      @change="computeClrhdzz"
                                      @keydown.native="handleKeyDown($event, 7, 1)"
                                      @paste.native="handlePasteFour($event,  1, 1)"
                                      :ref="`7_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- 表5-试样数据-->
                <table class="middle-table" style="height: 90px;">
                    <tbody>
                    <tr>
                        <td class="text-center" style="width: 8%;" height="30">
                            <span style="width:25px;display:inline-block">试样</span>
                        </td>
                        <td class="text-center" style="width: 17%;">
                            <span style="display:inline-block">加热试验前60℃黏度(Pa·s)</span>
                        </td>
                        <td class="text-center" style="width: 18%;">
                            <span style="display:inline-block">加热试验后60℃黏度(Pa·s)</span>
                        </td>
                        <td class="text-center" style="width: 14%;">
                            <span style="display:inline-block">加热试验黏度比(60℃)</span>
                        </td>
                        <td class="text-center" style="width: 14%;">
                            <span style="display:inline-block">平均值</span>
                        </td>
                        <td class="text-center" style="width: 11%;">
                            <span style="display:inline-block">加热试验的老化指数</span>
                        </td>
                        <td class="text-center" style="width: 18%;">
                            <span style="display:inline-block">平均值</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="30">
                            <el-input type="number"
                                      v-model="form.a9"
                                      @keydown.native="handleKeyDown($event, 8, 0)"
                                      @paste.native="handlePasteFive($event,  0, 0)"
                                      :ref="`8_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.b9"
                                      @change="computeJrsyndb(9)"
                                      @keydown.native="handleKeyDown($event, 8, 1)"
                                      @paste.native="handlePasteFive($event,  0, 1)"
                                      :ref="`8_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.c9"
                                      @change="computeJrsyndb(9)"
                                      @keydown.native="handleKeyDown($event, 8, 2)"
                                      @paste.native="handlePasteFive($event,  0, 2)"
                                      :ref="`8_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block">{{ form.d9 }}</span>
                        </td>
                        <td class="text-center" rowspan="2">
                            <span style="display:inline-block">{{ form.e9 }}</span>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block">{{ form.f9 }}</span>
                        </td>
                        <td class="text-center" rowspan="2">
                            <span style="display:inline-block">{{ form.g9 }}</span>
                        </td>
                    </tr>

                    <tr>
                        <td height="30">
                            <el-input type="number"
                                      v-model="form.a10"
                                      @keydown.native="handleKeyDown($event, 9, 0)"
                                      @paste.native="handlePasteFive($event,  1, 0)"
                                      :ref="`9_0`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.b10"
                                      @change="computeJrsyndb(10)"
                                      @keydown.native="handleKeyDown($event, 9, 1)"
                                      @paste.native="handlePasteFive($event,  1, 1)"
                                      :ref="`9_1`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td>
                            <el-input type="number"
                                      v-model="form.c10"
                                      @change="computeJrsyndb(10)"
                                      @keydown.native="handleKeyDown($event, 9, 2)"
                                      @paste.native="handlePasteFive($event,  1, 2)"
                                      :ref="`9_2`"
                                      :readonly="isPdf"
                            ></el-input>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block">{{ form.d10 }}</span>
                        </td>
                        <td class="text-center">
                            <span style="display:inline-block">{{ form.f10 }}</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- 附加声明 -->
                <table height="120px" class="bottom-table">
                    <tr>
                        <td>
                            <el-input type="textarea" :rows="2" v-model="form.fujsm" :readonly="isPdf"/>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- 表格底部签名区域 -->
            <table height="22px" class="transparent">
                <tbody>
                <tr>
                    <td width="10%" align="right">检测：</td>
                    <td width="15%" align="left"></td>
                    <td width="10%" align="right">记录：</td>
                    <td width="15%" align="left"></td>
                    <td width="10%" align="right">复核：</td>
                    <td align="left" width="15%"></td>
                    <td width="10%">日期：</td>
                    <td align="left" width="15%">
                        <div style="display: inline-block; margin-left: 20px">年</div>
                        <div style="display: inline-block; margin-left: 20px">月</div>
                        <div style="display: inline-block ;margin-left: 20px">日</div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
        <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
        <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType"></bs-judge-base-view>
    </div>
</template>

<script>
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";

import Bus from "@/utils/bus";
import {getCjlkzhhljlbBsInfo} from "@/api/report_jl/cjl";
import {handleFocus, handleKeyDown, handlePaste} from "@/views/reportForms/utils";
import decimal from "@/utils/big-decimal";
import {addYsDzkyqdsyBsInfo, getYsDzkyqdsyBsInfo, updateYsDzkyqdsyBsInfo} from "@/api/reportys/ysYsdzkyqdsyjcjlbBsInfo";
import {addLqBmjrBsInfo, getLqBmjrBsInfo, updateLqBmjrBsInfo} from "@/api/report_lq/bmjr";

export default {
    name: "bmjr",
    components: {BsJudgeBaseView, BsInstrumentView, BsJiancyjView},
    props: {
        excelId: {
            type: [String, Number],
            default: () => ""
        },
        syType: {
            type: [String, Number],
            default: () => ""
        },
        page: {
            type: Number,
            default: () => 0
        },
        isPdf: {
            type: Boolean,
            default: () => false
        },
        printEmpty: {
            type: Boolean,
            default: () => false
        }
    },
    data() {
        return {
            show: false,
            form: {
                excelId: undefined,
                totalPage: undefined,
                page: undefined,
                jilbh: undefined,
                jiancdwmc: undefined,
                gongcmc: undefined,
                gongcbwyt: undefined,
                yangpmc: undefined,
                yangpbh: undefined,
                yangpsl: undefined,
                yangpzt: undefined,
                yangpsj: undefined,
                shiyjcrq: undefined,
                shiytjwd: undefined,
                shiytjsd: undefined,
                jiancyj: undefined,
                pandyj: undefined,
                jiancyjIds: [],
                pandyjIds: [],
                zhuyyqsbmcjbh: undefined,
                shebIds: [],
                fujsm: undefined,

                a1: undefined,
                b1: undefined,
                c1: undefined,
                d1: undefined,
                e1: undefined,
                a2: undefined,
                b2: undefined,
                c2: undefined,
                d2: undefined,

                a3: undefined,
                b3: undefined,
                c3: undefined,
                d3: undefined,
                e3: undefined,
                f3: undefined,
                g3: undefined,
                h3: undefined,
                d4: undefined,
                e4: undefined,
                f4: undefined,
                g4: undefined,

                a5: undefined,
                b5: undefined,
                c5: undefined,
                d5: undefined,
                e5: undefined,
                f5: undefined,
                g5: undefined,
                a6: undefined,
                b6: undefined,
                c6: undefined,
                d6: undefined,
                e6: undefined,
                f6: undefined,
                g6: undefined,

                a7: undefined,
                b7: undefined,
                c7: undefined,
                d7: undefined,
                e7: undefined,
                f7: undefined,
                d8: undefined,
                e8: undefined,

                a9: undefined,
                b9: undefined,
                c9: undefined,
                d9: undefined,
                e9: undefined,
                f9: undefined,
                g9: undefined,
                a10: undefined,
                b10: undefined,
                c10: undefined,
                d10: undefined,
                f10: undefined,
            }
        };
    },
    created() {
        this.init();
    },
    methods: {
        init() {
            this.show = false;
            getLqBmjrBsInfo(this.excelId || this.$defaultExcelId).then((response) => {
                this.form = response.data;
                if (!this.form.fujsm) {
                    this.form.fujsm = "附加声明：";
                }
                this.setInitialValue();
                this.show = true;
            });
        },
        // 设置初始值
        setInitialValue() {
            if (this.form) {
                this.form.baobmc = this.form.baobmc || "沥青薄膜加热/旋转薄膜试验检测记录表";
                this.form.baobbh = this.form.baobbh || "JGL910006";
            }

        },

        // 显示仪器列表
        showBsInstrumentView() {
            this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
        },
        // 仪器选择
        selectInstrument(info) {
            this.form.zhuyyqsbmcjbh = info.label;
            this.form.shebIds = info.ids;
            // Bus.$emit("setYsJcBgZhuyyqsbmcjbh", {zhuyyqsbmcjbh: this.form.zhuyyqsbmcjbh, shebIds: this.form.shebIds});
        },
        // 显示检测依据列表
        showBsJiancyjView() {
            this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
        },
        // 检测依据选择
        selectJiancyj(info) {
            this.form.jiancyj = info.label;
            this.form.jiancyjIds = info.ids;
            // Bus.$emit("setYsJcBgJiancyj", {jiancyj: this.form.jiancyj, jiancyjIds: this.form.jiancyjIds});
        },
        // 显示判定依据列表
        showBsJudgeBaseView() {
            this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
        },
        // 判断依据选择
        selectJudge(info) {
            if (!this.form.pandyj) {
                this.form.pandyj = info.label;
                return;
            }
            if (info && info.label) {
                this.form.pandyj += "、" + info.label;
            }
        },
        handleFocus(event) {
            handleFocus(event, this.page, this.form[event]);
        },

        // 计算质量变化
        computeZlbh(index) {
            if (this.form['a' + index] && this.form['b' + index] && this.form['c' + index]) {
                let molecule = parseFloat(decimal.subtract(this.form['c' + index], this.form['b' + index]))
                let denominator = parseFloat(decimal.subtract(this.form['b' + index], this.form['a' + index]))
                this.form['d' + index] = denominator ? decimal.multiply(decimal.divide(molecule, denominator), 100, 1) : 0.0
            } else {
                this.form['d' + index] = undefined
            }

            // 计算平均质量损失
            this.computePjZlss()
        },

        // 计算平均质量损失
        computePjZlss() {
            if (this.form.d1 != null && this.form.d2 != null) {
                this.form.e1 = decimal.divide(decimal.add(this.form.d1, this.form.d2), 2, 1)
            } else if (this.form.d1 != null || this.form.d2 != null) {
                this.form.e1 = this.form.d1 || this.form.d2
            } else {
                this.form.e1 = undefined
            }
            // 报告传值质量损失相关数据
            this.backBgZlss()
        },

        // 报告传值质量损失相关数据
        backBgZlss() {
            Bus.$emit("setLqJCBgZlss", {
                zlss: this.form.e1,
            });
        },

        // 计算针入度平均值
        computeZrdPjz(index) {
            let arr = ['d', 'e', 'f']
            let sum = 0;
            let count = 0;
            arr.forEach(item => {
                if (this.form[item + index]) {
                    count++;
                    sum = decimal.add(sum, this.form[item + index])
                }
            })
            this.form['g' + index] = count ? decimal.divide(sum, count, 1) : undefined

            // 计算残留针入度比
            this.computeClzrdb()
        },

        // 计算残留针入度比
        computeClzrdb() {
            if (this.form.g3 && this.form.g4) {
                this.form.h3 = parseFloat(this.form.g3) ? decimal.multiply(decimal.divide(this.form.g4, this.form.g3), 100, 0) : 0
            } else {
                this.form.h3 = undefined
            }
            // 报告传值残留针入度相关数据
            this.backBgClzrdb()
        },

        // 报告传值残留针入度相关数据
        backBgClzrdb() {
            Bus.$emit("setLqJCBgClzrdb", {
                wd: this.form.a3,
                clzrd: this.form.h3,
            });
        },

        // 计算延度平均值
        computeYd(index) {
            let arr = ['d', 'e', 'f']
            let sum = 0;
            let count = 0;
            arr.forEach(item => {
                if (this.form[item + index]) {
                    count++;
                    sum = decimal.add(sum, this.form[item + index])
                }
            })
            this.form['g' + index] = count ? decimal.divide(sum, count, 0) : undefined

            // 报告传值残留延度相关数据
            this.backBgClyd()
        },

        // 报告传值残留延度相关数据
        backBgClyd() {
            Bus.$emit("setLqJCBgClyd", {
                wd1: this.form.a5,
                clyd1: this.form.g5,
                wd2: this.form.a6,
                clyd2: this.form.g6,
            });
        },

        // 计算残留软化点增值
        computeClrhdzz() {
            if (this.form.e8 != null && this.form.d8 != null) {
                this.form.f7 = decimal.subtract(this.form.e8, this.form.d8)
            } else {
                this.form.f7 = undefined
            }
        },

        // 计算加热试验黏度比
        computeJrsyndb(index) {
            if (this.form['b' + index] && this.form['c' + index]) {
                this.form['d' + index] = parseFloat(this.form['b' + index]) ? decimal.divide(this.form['c' + index], this.form['b' + index]) : 0.00
            } else {
                this.form['d' + index] = undefined
            }
            // 计算加热试验黏度比平均值
            this.computeJrsyndbPjz()

            //计算加热试验的老化指数
            this.computeJrsylhzs(index)
        },

        // 计算加热试验黏度比平均值
        computeJrsyndbPjz() {
            if (this.form.d9 != null && this.form.d10 != null) {
                this.form.e9 = decimal.divide(decimal.add(this.form.d9, this.form.d10), 2)
            } else if (this.form.d9 != null || this.form.d10 != null) {
                this.form.e9 = this.form.d9 || this.form.d10
            } else {
                this.form.e9 = undefined
            }
        },

        // 计算加热试验的老化指数
        computeJrsylhzs(index) {
            if (this.form['b' + index] && this.form['c' + index]) {
                this.form['f' + index] = decimal.subtract(Math.log10(Math.log10(decimal.multiply(this.form['c' + index], 1000))), Math.log10(Math.log10(decimal.multiply(this.form['b' + index], 1000))))
            } else {
                this.form['f' + index] = undefined
            }
            // 计算加热试验的老化指数平均值
            this.computeJrsylhzsPjz()
        },

        // 计算加热试验的老化指数平均值
        computeJrsylhzsPjz() {
            if (this.form.f9 != null && this.form.f10 != null) {
                this.form.g9 = decimal.divide(decimal.add(this.form.f9, this.form.f10), 2)
            } else if (this.form.f9 != null || this.form.f10 != null) {
                this.form.g9 = this.form.f9 || this.form.f10
            } else {
                this.form.g9 = undefined
            }
        },


        // 返回报告引入值
        backBgzFun() {
            // Bus.$emit("setYsBgBase", {
            //     shiyyt: this.form.shiyyt,
            //     yansclms: this.form.yansclms,
            //     shijxz: this.form.shijxz,
            // });
        },

        // 提交表单
        submitForm() {
            return this.form;
        },

        // 鼠标移动操作
        handleKeyDown(event, rowIndex, colIndex) {
            const maxArr = [2, 2, 5, 2, 5, 5, 4, 1, 2, 2]; // 每一行最多有多少可聚焦输入框（从0开始）
            const ref = handleKeyDown(event, rowIndex, colIndex, maxArr);
            if (this.$refs[ref]?.length) {
                this.$refs[ref][0].focus();
            } else if (this.$refs[ref]) {
                this.$refs[ref].focus();
            }
        },

        // 粘贴赋值方法-质量损失
        handlePaste(event, rowIndex, colIndex) {
            const nameAllArr = [
                ["a1", "b1", "c1"],
                ["a2", "b2", "c2"],
            ];
            const subscriptArr = [
                [0, 1, 2],
                [0, 1, 2],
            ];

            const methodsAllArr = [
                ['computeZlbh', 'computeZlbh', 'computeZlbh'],
                ['computeZlbh', 'computeZlbh', 'computeZlbh'],
            ];
            const parameterArr = [
                [1, 1, 1],
                [2, 2, 2],
            ];
            const data = handlePaste(event, rowIndex, colIndex, nameAllArr, methodsAllArr, parameterArr, subscriptArr);
            const {cols, nameSetArr, methodsSetArr, parameterSetArr, subscriptSetArr} = data;
            for (let a = 0; a < nameSetArr.length; a++) {
                for (let b = 0; b < nameSetArr[a].length; b++) {
                    this.form[nameSetArr[a][b]] = cols[a][b];
                }
            }
            for (let a = 0; a < methodsSetArr.length; a++) {
                for (let b = 0; b < methodsSetArr[a].length; b++) {
                    if (methodsSetArr[a][b]) {
                        this.setCalculate(methodsSetArr[a][b], parameterSetArr[a][b]);
                    }
                }
            }
        },

        // 粘贴赋值方法-残留针入度比
        handlePasteTwo(event, rowIndex, colIndex) {
            const nameAllArr = [
                ["d3", "e3", "f3"],
                ["d4", "e4", "f4"],
            ];
            const subscriptArr = [
                [0, 1, 2],
                [0, 1, 2],
            ];

            const methodsAllArr = [
                ['computeZrdPjz', 'computeZrdPjz', 'computeZrdPjz'],
                ['computeZrdPjz', 'computeZrdPjz', 'computeZrdPjz'],
            ];
            const parameterArr = [
                [3, 3, 3],
                [4, 4, 4],
            ];
            const data = handlePaste(event, rowIndex, colIndex, nameAllArr, methodsAllArr, parameterArr, subscriptArr);
            const {cols, nameSetArr, methodsSetArr, parameterSetArr, subscriptSetArr} = data;
            for (let a = 0; a < nameSetArr.length; a++) {
                for (let b = 0; b < nameSetArr[a].length; b++) {
                    this.form[nameSetArr[a][b]] = cols[a][b];
                }
            }
            for (let a = 0; a < methodsSetArr.length; a++) {
                for (let b = 0; b < methodsSetArr[a].length; b++) {
                    if (methodsSetArr[a][b]) {
                        this.setCalculate(methodsSetArr[a][b], parameterSetArr[a][b]);
                    }
                }
            }
        },

        // 粘贴赋值方法-残留延度
        handlePasteThree(event, rowIndex, colIndex) {
            const nameAllArr = [
                ["a5", "b5", "c5", "d5", "e5", "f5"],
                ["a6", "b6", "c6", "d6", "e6", "f6"],
            ];
            const subscriptArr = [
                [0, 1, 2, 3, 4, 5],
                [0, 1, 2, 3, 4, 5],
            ];

            const methodsAllArr = [
                ['backBgClyd', null, null, 'computeYd', 'computeYd', 'computeYd'],
                ['backBgClyd', null, null, 'computeYd', 'computeYd', 'computeYd'],
            ];
            const parameterArr = [
                [null, null, null, 5, 5, 5],
                [null, null, null, 6, 6, 6],
            ];
            const data = handlePaste(event, rowIndex, colIndex, nameAllArr, methodsAllArr, parameterArr, subscriptArr);
            const {cols, nameSetArr, methodsSetArr, parameterSetArr, subscriptSetArr} = data;
            for (let a = 0; a < nameSetArr.length; a++) {
                for (let b = 0; b < nameSetArr[a].length; b++) {
                    this.form[nameSetArr[a][b]] = cols[a][b];
                }
            }
            for (let a = 0; a < methodsSetArr.length; a++) {
                for (let b = 0; b < methodsSetArr[a].length; b++) {
                    if (methodsSetArr[a][b]) {
                        this.setCalculate(methodsSetArr[a][b], parameterSetArr[a][b]);
                    }
                }
            }
        },

        // 粘贴赋值方法-残留软化点增值
        handlePasteFour(event, rowIndex, colIndex) {
            const nameAllArr = [
                ["d7", "e7"],
                ["d8", "e8"],
            ];
            const subscriptArr = [
                [0, 1],
                [0, 1],
            ];

            const methodsAllArr = [
                [null, null],
                ['computeClrhdzz', 'computeClrhdzz'],
            ];
            const parameterArr = [
                [null, null],
                [null, null],
            ];
            const data = handlePaste(event, rowIndex, colIndex, nameAllArr, methodsAllArr, parameterArr, subscriptArr);
            const {cols, nameSetArr, methodsSetArr, parameterSetArr, subscriptSetArr} = data;
            for (let a = 0; a < nameSetArr.length; a++) {
                for (let b = 0; b < nameSetArr[a].length; b++) {
                    this.form[nameSetArr[a][b]] = cols[a][b];
                }
            }
            for (let a = 0; a < methodsSetArr.length; a++) {
                for (let b = 0; b < methodsSetArr[a].length; b++) {
                    if (methodsSetArr[a][b]) {
                        this.setCalculate(methodsSetArr[a][b], parameterSetArr[a][b]);
                    }
                }
            }
        },

        // 粘贴赋值方法-试样数据
        handlePasteFive(event, rowIndex, colIndex) {
            const nameAllArr = [
                ["a9", "b9", "c9"],
                ["a10", "b10", "c10"],
            ];
            const subscriptArr = [
                [0, 1, 2],
                [0, 1, 2],
            ];

            const methodsAllArr = [
                [null, 'computeJrsyndb', 'computeJrsyndb'],
                [null, 'computeJrsyndb', 'computeJrsyndb'],
            ];
            const parameterArr = [
                [null, 9, 9],
                [null, 10, 10],
            ];
            const data = handlePaste(event, rowIndex, colIndex, nameAllArr, methodsAllArr, parameterArr, subscriptArr);
            const {cols, nameSetArr, methodsSetArr, parameterSetArr, subscriptSetArr} = data;
            for (let a = 0; a < nameSetArr.length; a++) {
                for (let b = 0; b < nameSetArr[a].length; b++) {
                    this.form[nameSetArr[a][b]] = cols[a][b];
                }
            }
            for (let a = 0; a < methodsSetArr.length; a++) {
                for (let b = 0; b < methodsSetArr[a].length; b++) {
                    if (methodsSetArr[a][b]) {
                        this.setCalculate(methodsSetArr[a][b], parameterSetArr[a][b]);
                    }
                }
            }
        },

        // 计算方法调用
        setCalculate(name, a, b, c, d, e) {
            this[name](a, b, c, d, e);
        }
    }
}
</script>

<style scoped lang="scss">
.td-input {
  width: 100% !important;
  height: 30px !important;
}

</style>
